public class ArrayQueue<T> implements Queue<T> {

    private Array<T> array;

    public ArrayQueue(int capacity){
        array = new Array<>(capacity);
    }
    public ArrayQueue(){
        array = new Array<T>();
    }

    @Override
    public T dequeue() {
        return array.removeFirst();
    }

    @Override
    public void enqueue(T t) {
        array.addLast(t);
    }

    @Override
    public int getSize() {
        return array.getSize();
    }

    @Override
    public boolean isEmpty() {
        return array.isEmpty();
    }

    @Override
    public T getFront() {
        return array.getFirst();
    }

    @Override
    public String toString(){
        StringBuffer sb = new StringBuffer();
        sb.append("queue front : [");
        for(int i=0;i<array.getSize();i++){
            sb.append(array.get(i));
            if(i != array.getSize() - 1){
                sb.append(",");
            }
        }
        sb.append("] tail");
        return sb.toString();
    }
}
